package com.zblwyj.hanlder;

import com.zblwyj.bean.User;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.amqp.utils.SerializationUtils;
import org.springframework.stereotype.Component;

/**
 * 用于监听某个队列或多个队列数据
 */
@Component
@RabbitListener(queues = {"wfx-quence"})
public class ReceiveDirectHanlder1 {

    @RabbitHandler//标记当前方法是用来处理消息的
    public void recevieMsg(String message) {
        System.out.println("wfx-quence队列收到消息: =>"+message);
    }

    @RabbitHandler//标记当前方法是用来处理消息的
    public void recevieMsg(byte[] bs) {
        User user = (User) SerializationUtils.deserialize(bs);
        System.out.println("wfx-quence队列收到消息: 字节数组=>" + user);
    }


}